#pragma once
#include"RBTree.h"

namespace myset
{
	template<class K, class KeyOfT>
	class set
	{
	public:
		typedef rbtree::RBTreeIterator<K, const K*, const K&> const_iterator;
		typedef rbtree::RBTreeIterator<K, K*, K&> iterator;
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
		iterator begin()
		{
			return _rbt.Begin();
		}
		iterator end()
		{
			return _rbt.End();
		}

		const_iterator begin()const
		{
			return _rbt.Begin();
		}
		const_iterator end()const
		{
			return _rbt.End();
		}
		bool insert(const K& key)
		{
			_rbt.Insert(key);
		}

		int size()
		{
			return _rbt.Size();
		}
		int height()
		{
			return _rbt.Height();
		}
	private:
		rbtree::RBTree<K,K, SetKeyOfT> _rbt = nullptr;
	};
}